package com.gem.demo.service.impl;

import com.gem.demo.entity.Product;
import com.gem.demo.mapper.ProductMapper;
import com.gem.demo.service.ProductService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;
    @Override
    public List<Product> list(int typeid) {
        return productMapper.selectByType(typeid);
    }

    @Override
    public PageInfo<Product> listPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Product>products=productMapper.selectAll();
        return new PageInfo<Product>(products);
    }
}
